package com.ea.mapper;


import com.ea.domain.dto.ElectricGoodsSkuDTO;
import com.ea.domain.dto.LogisticInfoCallBackOrderDTO;
import com.ea.domain.dto.TotalSaleDTO;
import com.ea.domain.query.OrderInfoQueryDTO;
import com.ea.domain.query.OrderManageQueryDTO;
import com.ea.domain.query.TotalSaleQuery;
import com.ea.domain.vo.OrderInfoVO;
import com.ea.domain.vo.OrderManageVO;
import com.ea.domain.dto.OrderManageUpdateDTO;
import com.ea.domain.entity.OrderFormInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 订单信息主表 Mapper 接口
 * </p>
 *
 * @author 电器商城
 * @since 2022-11-29
 */
@Mapper
public interface OrderFormInfoMapper  {

    /**
     * 根据条件查找订单信息
     * @param queryDTO
     * @return
     */
    List<OrderManageVO> selectAllByCondition(OrderManageQueryDTO queryDTO);

    /**
     * 根据orderId查找订单信息
     * @param orderId
     * @return
     */
    OrderFormInfo selectOneByOrderId(Long orderId);

    /**
     * 根据orderIdList查找订单信息
     * @param orderIdList
     * @return list
     */
    List<OrderFormInfo> selectAllByOrderIdList(List<Long> orderIdList);

    /**
     * 根据orderIdList查找订单信息
     * @param orderIdList
     * @return list
     */
    List<OrderFormInfo> selectAllByOrderIdListV2(List<Long> orderIdList);
    /**
     * 修改订单信息
     * @param updateDTO
     * @return
     */
    boolean updateOrderInfo(OrderManageUpdateDTO updateDTO);

    /**
     * 添加卖家备注
     * @param orderId
     * @param sellerMemo
     * @return
     */
    boolean addOrderInfoSellerMemoByOrderId(@Param("orderId")Long orderId, @Param("sellerMemo")String sellerMemo);

    /**
     * 买家修改备注
     * @param orderId
     * @param buyerMemo
     * @return
     */
    boolean modifyOrderInfoBuyerMemoByOrderId(@Param("orderId")Long orderId, @Param("buyerMemo")String buyerMemo);


    /**
     * 批量确认订单
     * @param orderIdList
     */
    void batchConfirmOrderInfo(List<Long> orderIdList);

    /**
     * 批量确认发货
     * @param orderIdList
     */
    void batchDeliverOrderInfo(List<Long> orderIdList);

    /**
     * 创建订单
     * @param orderFormInfo
     */
    void createOrderInfo(OrderFormInfo orderFormInfo);

    /**
     * 根据类型修改订单状态
     * @param orderId
     * @param status
     * @param type
     */
    void updateStatusByType(@Param("orderId")Long orderId, @Param("status")Integer status, @Param("type")String type);


    /**
     * 查找用户订单信息
     * @param queryDTO queryDTO
     * @return list
     */
    List<OrderInfoVO> queryOwnerOrderInfo(OrderInfoQueryDTO queryDTO);

    /**
     * 更新物流单回传订单信息
     * @param list
     */
    void updateCallBackOrder(List<LogisticInfoCallBackOrderDTO> list);

    /**
     * 查询今天的订单数量
     * @param date
     * @return
     */
    Integer selectTodayOrderCount();

    /**
     * 查询今日销售额
     * @param date
     * @return
     */
    BigDecimal selectTodayOrderTotalMoney();

    /**
     * 查询待确认的订单数
     * @return
     */
    Integer seleteOrderBeSend();

    /**
     * 查询待买家确认收货的订单数
     * @return
     */
    Integer seleteOrderBeConfirm();


    List<TotalSaleDTO> selectTotalPriceByTime(TotalSaleQuery query);


}
